<template>
	<view class="qrcode">
		<view class="top d-flex">
			<!-- <u-image :src="data.goods_image" width="160rpx" height="160rpx" radius="12rpx"></u-image> -->
			<view style="margin-left: 30rpx;">
				<view class="name ">{{data.venue_name}}</view>
				<view >
					<view class="date">{{data.field_name}}</view>
				</view>
				<view class="venue_name">{{data.day}}-{{data.stime}}-{{data.etime}}</view>
				<view class="share_a" >{{data.place_name}}</view>
			</view>
		</view>

		<view class="qrcode-wrapper">
			<!-- <view class="chooses flex-between" >
				<view class="my-menu">
					<view class="cates">
						<view class="cates" @click="onClickMenulist">
							<view class="cate-item pr">
								<u-image :src="fenxiang_img" width="80rpx" height="80rpx" :showMenuByLongpress="false"></u-image>
								<text>分享球场</text>
							</view>
						</view>
						<view class="catess" @click="chaoshi">
							<view class="cate-item pr">
								<u-image :src="chaoshi_img" width="80rpx" height="80rpx" :showMenuByLongpress="false"> </u-image>
								<text>超时出场</text>
							</view>
						</view>
						<view class="catesss" @click="dengguan">
							<view class="cate-item pr">
								<u-image :src="kaiguan_img" width="80rpx" height="80rpx" :showMenuByLongpress="false"></u-image>
								<text>开关灯光</text>
							</view>
						</view>
					</view>
				</view>
			</view> -->

			<view class="d-flex align-center flex-column" :hidden="!vueShowModel">
				<view class="destroy-code">核销码：{{ qr_code }}</view>
				<view class="tip">请在核验时出示，注意保管勿泄露</view>
				<!-- <u-image width="370rpx" height="370rpx"></u-image> -->
				<uQRCode ref="qrcode" canvas-id="qrcode" :value="qr_code" size="185"></uQRCode>
				<!-- <view class="tip">请在核验时出示，注意保管勿泄露</view> -->
				<view class="tips" v-if="options.title == '我的场地'">
					<view class="" v-if="options.beShare == 0">
						开场前<text style="color: #ffaa00;">{{ data.permit_in_time }}</text> 分钟允许进场；结束后<text
							style="color: #ffaa00;">{{ data.permit_in_time }}</text> 分钟离场，请勿超时！</view>
				</view>
			</view>
		</view>

		<div class="vueMdelBox">
			<div :hidden="vueShowModel" class="vueContant">
				<div class="vueTitle">是否申请开灯！</div>
				<div class="vueBtn">
					<u-button text="我再想想" shape="circle" size="small"
						color="linear-gradient(0deg, rgb(211, 211, 211) 0%, rgb(211, 211, 211) 65%)" @click="cancel()">
					</u-button>
					<u-button text="提交" shape="circle" size="small"
						color="linear-gradient(0deg, #0E9698 0%, #0E9698 65%)" @click="cancel()">
					</u-button>
				</div>
			</div>
			<div class="vueBgdCol" :hidden="vueShowModel" @click="setting()"></div>
		</div>
	</view>
</template>

<script>
	const index = require('@/api/index/index.js')
	import uQRCode from '@/uni_modules/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue'
	export default {
		components: {
			uQRCode
		},
		data() {
			return {
				fenxiang_img: this.$https.assetsPath + "20231123/81cd5eef0e286fd930914c3f7acea054.png",
				chaoshi_img: this.$https.assetsPath + "20231123/e11208336d632e21ab6839cddd7fb500.png",
				kaiguan_img: this.$https.assetsPath + "20231123/5e1102fcc89ebb89b3ad511de9c7dee7.png",
				list1: [],
				data: {},
				options: {},
				qr_code: '',
				timer: null,
				codes: '',
				not_in_time: '',
				vueShowModel: true, //默认不显示
				chosen_id: '',
				is_over: '',
				qrcode:'22222222222',
				ids:''
			}
		},
		onLoad(options) {
			this.ids = options.ids
			this.timer = null;
			this.placeview()
			// uni.setNavigationBarTitle({
			// 	title: '篮球场'
			// });
		},
		onShow() {
			let that = this;
			that.timer = null;
			clearInterval(that.timer);
			that.timer = setInterval(() => {
				// that.placeview()
			}, 300000);
		},
		onUnload() {
			let that = this;
			clearInterval(that.timer);
			that.timer = null;
		},
		onHide() {
			let that = this;
			clearInterval(that.timer);
			that.timer = null;
		},
		methods: {

			// 点击按钮打开弹框
			vueToMdel() {
				this.vueShowModel = false;
			},
			// 点击蒙版按钮模态框消失
			setting() {
				this.vueShowModel = true;
			},
			// 点击取消按钮模态框消失
			cancel() {
				this.vueShowModel = true;
			},
			// 点击确定按钮模态框消失
			confirm() {
				this.vueShowModel = true;
			},

			dengguan() {
				if (this.not_in_time == 1) {
					this.vueShowModel = false;
				}
			},

			// onClickMenulist() {
			// 	if (this.options.field_type != 2 && this.is_over != 1) {
			// 		uni.navigateTo({
			// 			url: '../../../page_venues/pages/venuesDetail/sharedBy/sharedBy?id=' + this.options.id +
			// 				"&court_no=" + this.codes +
			// 				"&beShare=" + this.options.beShare
			// 		})
			// 		var that = this;
			// 		clearInterval(that.timer);
			// 		that.timer = null;
			// 	} else {
			// 		uni.showToast({
			// 			title: '您暂无分享权利。',
			// 			icon: 'error',
			// 			duration: 1500
			// 		});
			// 	}
			// },
			// onClickMenu(item, index) {
			// 	if (index == 0) {
			// 		uni.navigateTo({
			// 			url: '../../../page_venues/pages/venuesDetail/sharedBy/sharedBy?id=' + this.options.id +
			// 				"&court_no=" + this.codes +
			// 				"&beShare=" + this.options.beShare
			// 		})
			// 		var that = this;
			// 		clearInterval(that.timer);
			// 		that.timer = null;
			// 	} else if (index == 1) {
			// 		var that = this;
			// 		clearInterval(that.timer);
			// 		that.timer = null;
			// 		uni.navigateTo({
			// 			url: '/pages/overtime/index'
			// 		})
			// 	}
			// },
			// getdata() {
			// 	var that = this;
			// 	if (uni.$u.pages()[uni.$u.pages().length - 1].route == 'pages/personal/qrcode/qrcode') {} else {
			// 		clearInterval(that.timer);
			// 		that.timer = null;
			// 	}
			// },

			// 获取我的场地详情
			async placeview() {
				let param_s = {
					ids: this.ids,
				}
				let res = await index.placeview(param_s)
				if (res.code == 1) {
					this.data = res.data
					this.qr_code = res.data.qr_code
					uni.setNavigationBarTitle({
						title: this.data.venue_name
					});

					let items = JSON.stringify(res.data.ticketData);
					uni.setStorageSync("wqzdy", items);

					var datas = uni.getStorageSync("wqzdy");
					var itemss = JSON.parse(datas)
					console.log(itemss, '2222222')
					// this.getDynamicCodes()
				}
			},
			// async getDynamicCodes() {
			// 	let params = {
			// 		goods_type: '3',
			// 		project_id: getApp().globalData.projectId,
			// 		app_id: this.$https.weixinAppId,
			// 		goods_id: this.data.id,
			// 		beshared: this.options.beShare,
			// 		code: this.codes,
			// 		open_id: uni.getStorageSync("openid"),
			// 		choose_id: this.data.id
			// 	}
			// 	let res = await person.getDynamicCode(params)
			// 	if (res.code === 1) {
			// 		this.code = res.data.result.code
			// 		this.not_in_time = res.data.result.not_in_time

			// 	}
			// },
			// chaoshi() {
			// 	if (this.is_over == 1) {
			// 		uni.navigateTo({
			// 			url: '/pages_a/overtime/overtime?court_id=' + this.options.court_id +
			// 				"&chosen_id=" + this.chosen_id
			// 		})
			// 	} else {
			// 		uni.showModal({
			// 			// title: data[1],
			// 			content: '您没有超时账单，请尽快离场。',
			// 			showCancel: false,
			// 			success: function(res) {
			// 				if (res.confirm) {
			// 					console.log('用户点击确定');
			// 				} else if (res.cancel) {
			// 					console.log('用户点击取消');
			// 				}
			// 			}
			// 		});
			// 	}
			// },
		}
	}
</script>

<style lang="scss" scoped>
	// @import url("@/static/css/personal/index.css");
	.qrcode {
		min-height: 100vh;
		background-color: #e0e8fc;
		padding: 20rpx;
		padding-bottom: calc(20rpx + env(safe-area-inset-bottom));

		.top {
			border-radius: 20rpx;
			padding: 30rpx 24rpx;
			background-color: #fff;
			margin-bottom: 30rpx;

			.share_a {
				width: 140rpx;
				height: 60rpx;
				border-radius: 50%;
				position: absolute;
				top: 3.3%;
				right: 3rpx;
				font-size: 28rpx;
				color: #999999;
			}

			.share_s {
				width: 140rpx;
				height: 60rpx;
				border-radius: 50%;
				position: absolute;
				top: 11.3%;
				right: 3rpx;
				font-size: 28rpx;
				color: #ff0000;
			}

			.name {
				font-weight: bold;
				color: #333;
				margin-bottom: 20rpx;
			}

			.date {
				// background-color: rgb(240, 138, 34);
				color: #333;
				font-size: 24rpx;
				border-radius: 100px;
				padding: 4rpx 20rpx;
				// float: left;
				margin-right: 10rpx;
				font-weight: 550;
			}

			.venue_name {
				font-size: 30rpx;
				color: #000;
				margin-top: 20rpx;
			}
		}

		.qrcode-wrapper {
			border-radius: 10rpx;
			background-color: #fff;
			overflow: hidden;
			padding-bottom: 60rpx;

			.choose {
				background-color: #f7f7f7;
				padding: 49rpx 30rpx 51rpx 31rpx;
			}

			.chooses {
				background-color: #f7f7f7;
				padding: 75rpx 30rpx 80rpx 31rpx;

				.my-menu {
					position: absolute;
					// top: 240rpx;
					// left: 5%;
					transform: translate(-50%);
				}

				.cates {
					display: flex;
					justify-content: center;
					position: absolute;
					top: 50%;
					left: 22rpx;
					transform: translateY(-50%);
				}

				.catess {
					display: flex;
					justify-content: center;
					position: absolute;
					top: 50%;
					left: 210rpx;
					transform: translateY(-50%);
				}

				.catesss {
					display: flex;
					justify-content: center;
					position: absolute;
					top: 50%;
					left: 390rpx;
					transform: translateY(-50%);
				}

				.cate-item {
					width: 200rpx;
					font-size: 24rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
				}

				.cate-item text {
					margin-top: 10rpx;
				}

			}

			.destroy-code {
				color: #0E9698 ;
				// margin: 40rpx 0;
				margin: 40rpx 0 20rpx 0;
			}

			.tip {
				margin: 10rpx 0 30rpx 0;
				color: #999;
				font-size: 28rpx;
			}

			.tips {
				margin-top: 20rpx;
				color: #999;
				font-size: 28rpx;
			}
		}

		.fenxiang {
			color: #fff;
			margin-top: 29rpx;
		}

		.vueBgdCol {
			position: fixed;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index: 1001;
			-moz-opacity: 0.8;
			opacity: 0.8;
			filter: alpha(opacity=88);
		}

		.vueContant {
			position: fixed;
			top: 40%;
			left: 50%;
			width: 600rpx;
			height: 300rpx;
			margin-left: -305rpx;
			margin-top: -76px;
			background-color: white;
			z-index: 1002;
			overflow: auto;
			border-radius: 20rpx;
		}

		.vueTitle {
			display: flex;
			justify-content: center;
			font-size: 28rpx;
			padding-top: 55rpx;
			font-weight: 600;
		}

		.vueContants {
			position: fixed;
			top: 40%;
			left: 50%;
			width: 600rpx;
			height: 330rpx;
			margin-left: -320rpx;
			margin-top: -76px;
			background-color: white;
			z-index: 1002;
			overflow: auto;
			border-radius: 20rpx;
		}

		.vueTits {
			display: flex;
			justify-content: center;
			font-size: 28rpx;
			padding-top: 75rpx;
			font-weight: 600;
		}

		.vueDetail {
			font-size: 28rpx;
			color: #646566;
			display: flex;
			// justify-content: center;
			padding: 32rpx;
			height: 48rpx;
			margin-right: 20rpx;
		}

		/deep/.u-tag {
			margin-left: 20rpx;

		}

		/deep/.u-textarea {
			background-color: #f3f3f3;
			margin-top: 80rpx;
		}

		/deep/.u-button {
			width: 30%;
			height: 60rpx;
		}

		.vueBtn {
			display: flex;
			margin-top: 80rpx;
		}

		.vueBtns {
			display: flex;
			margin-top: 100rpx;
		}

		.vueBtn span {
			width: 320rpx;
			height: 96rpx;
			font-size: 24rpx;
			font-weight: 600;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.vueBtn span:first-child {
			border-top: 1px solid #ebedf0;
		}

		.vueBtn span:last-child {
			color: #ee0a24;
			border-top: 1px solid #ebedf0;
			border-left: 1px solid #ebedf0;
		}
	}
</style>
